﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:ec="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions" xmlns:Converter="clr-namespace:AllBots.Converter" x:Class="AllBots.View.FamousBotsView"
    mc:Ignorable="d"
    d:DesignHeight="480" d:DesignWidth="480"
    >

    <UserControl.Resources>
        <Converter:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
    </UserControl.Resources>
    <UserControl.FontFamily>
        <StaticResource ResourceKey="PhoneFontFamilyNormal"/>
    </UserControl.FontFamily>
    <UserControl.FontSize>
        <StaticResource ResourceKey="PhoneFontSizeNormal"/>
    </UserControl.FontSize>
    <UserControl.Foreground>
        <StaticResource ResourceKey="PhoneForegroundBrush"/>
    </UserControl.Foreground>
    <UserControl.DataContext>
        <Binding Path="FamousBots" Source="{StaticResource Locator}"/>
    </UserControl.DataContext>

    <Grid Background="{StaticResource OverlayBrush}">
        <ListBox Padding="5,0,0,0" VerticalContentAlignment="Bottom" ItemsSource="{Binding FamousBots}" ItemTemplate="{StaticResource BotDataTemplate}">
            <i:Interaction.Triggers>
                <ec:DataTrigger Binding="{Binding IdSent}" Value="True">
                    <ec:NavigateToPageAction TargetPage="/ChatPage.xaml"/>
                </ec:DataTrigger>
            </i:Interaction.Triggers>
        </ListBox>
        <StackPanel Orientation="Vertical" VerticalAlignment="Center" Visibility="{Binding BotsLoading, Converter={StaticResource BooleanToVisibilityConverter}}">
            <TextBlock TextWrapping="Wrap" Text="{Binding AppResources.LoadingText, Source={StaticResource Localizator}}" HorizontalAlignment="Center"/>
            <ProgressBar VerticalAlignment="Center" IsIndeterminate="True"/>
        </StackPanel>
    </Grid>
</UserControl>
